/*
 * File Name: ScanService.java 
 * History:
 * Created by zhangzhiyong on 2013-9-26
 */
package com.denny.devdemo.clearer.worker;

import com.denny.devdemo.util.LogUtils;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public class ScanService extends Service{

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
    
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        LogUtils.e("start service");
        
        new Thread(){
            int i = 10;
            public void run() {
                while(i>0){
                    LogUtils.e("run service...."+i);
                    i--;
                }
//                stopSelf();
            };
        }.start();
        return START_STICKY;
    }
    
    @Override
    public void onDestroy() {
        LogUtils.e("onDestroy service");
        super.onDestroy();
        Intent intent1 = new Intent(this,ScanService.class);
        startService(intent1);
    }
}
